<div id="topnav">
  <div class="w">
    <div id="quicklinks" class="fright">
      <ul>
        <li><?php if(user_logged_in()){?>Welcome! <a href="/user/dashboard/"><?php $user=Session::newInstance()->_get('current_user'); echo $user->getFirst_name();//print_r($user->toArray()); ?><a> | <a href="/user/sign-out/">Sign out</a> <?php }else{ ?>Welcome! <a href="/user/sign-in/"> Sign in </a> or <a href="/user/register/"> Join Free </a><?php } ?></li>
        <li><a href="/help/">Help</a></li>
        <li><a href="/blog/">Blog</a></li>
        <li><a href="/community/">Community</a></li>
        <li><a href="/feedback/">Feedback</a></li>
      </ul>
    </div>
  </div>
</div>
<div id="header" class="w">
  <h1 class="logo"> <a href="/"> Myhighst your neighbourhood classified</a> </h1>
  <div style="class: fright">
    <div class="fright">
      <div id="postadd"> <a class="btn-base btn-red" href="/item/new/">POST YOUR ADD FREE</a> </div>
    </div>
    <div id="nav" class="fright">
      <ul>
	    <li class="btn-base btn-blue"><a href="/jobs/">JOBS</a></li>
        <li class="btn-base btn-green"><a href="/property/">Property</a></li>
        <li class="btn-base btn-red"><a href="/cars/">Cars</a></li>
        <li class="btn-base btn-orange"><a href="/buy-and-sell/">Buy &amp; Sell</a></li>
        <li class="btn-base btn-purpal"><a href="/people/">People</a></li>
      </ul>
    </div>
  </div>
  <div class="clearfix"></div>
  <div id="searchbox" class="btn-gray btlr7 btrr7">
    <h2 >United Kingdom</h2>
    <div>
      <form id="mainsearch" method="get" action="/search/">
        <fieldset>
          <label class="title" for="search">
          <span class="title">I'm looking</span>
          <input class="searchwhat pre_value" name="s" title="e.g. Plumbers, flat or a company name" value="<?php echo Params::getParam('s'); ?>" rel="e.g. Plumbers, flat or a company" />
          <label for="location">
          <span class="title">In</span>
          <input class="bylocation pre_value"  name="in" title="e.g. UK, town, postcode"  value="<?php echo Params::getParam('in'); ?>" rel="" />
          <label class="title" for="category">
          <span class="title"> In </span>
          <select style="padding: 4px 3px;" class="category" name="c">
            <option value="all">All Categories</option>
            <?php 
			$items=view::newInstance()->_get('main_categories');
			$prefix='&nbsp;&nbsp;';
			//$items=array();
			$cat=Params::getParam('c');	
			foreach($items as $key=>$item) {
				
				if($item['parent_id']==0){
					$prefix='';
				}
				
			?>
            <option value="<?php echo $item['slug']; ?>" <?php if($item['slug']==$cat) echo 'selected="selected"'; ?> ><?php echo $item['name']; ?></option>
				<?php if(isset($item['child'])){ create_options($item['child'],'slug','name',$prefix.'&nbsp;&nbsp;',$cat);  } ?>
            <?php } ?>
          </select>
          <button class="btn-base btn-red search" type="submit"> Search </button>
          <label class="advsearch"> <span> <a href="#">Advanced Search</a> </span> </label>
        </fieldset>
      </form>
    </div>
  </div>
</div>
